#include <stdlib.h>

#include "lib.h"
#include "CHoldemSQL.h"
#include "CSavedGame.h"
#include "odbc.h"
#include "missinggamenums.h"
#include "opts.h"
#include "CHoldemGame.h"
#include "stdncerr.h"

#include "memory.h"


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::CHoldemSQL(ProgressiveTrackSQL *pTracker, CInfo *pInfo)
///
/// @param  pTracker    pointer to this server's tracker object...used to get connections to the database.
/// @param  pInfo       object that holds info on the players session...created during the login process.
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
CHoldemSQL::CHoldemSQL(ProgressiveTrackSQL *pTracker, CInfo *pInfo) : CDBInterface(pTracker, pInfo)
{

#ifdef USE_MISSINGGAMENUMS
    //missing game nums deleted in TrackSQL::~TrackSQL
    missinggamenums = new MissingGameNums(this, "pub_getTableIdentityHoldemPoker");
#endif
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::createGame(int32 casinoId, const PID& pid, bool8 forMoney, SESSIONID sessionId, 
///                                int32 compFactor, CPokerGameID gid, int32 bet, int32 progressiveBet,
///                                int32 multiBankBet, int32* balance, int32* comp, uint8 payTable)
//
/// Creates database records for a new Caribbean Holdem game.
///
/// @param  casinoID        (in)
/// @param  pid             (in)  unique identifier for the current player
/// @param  forMoney        (in)  is this session for fun or for money?
/// @param  sessionId       (in)  unique identifier for the player's current session
/// @param  compFactor      (in)
/// @param  gid             (out) unique identifier for this current game that we're about to create
/// @param  bet             (in)  
/// @param  progressiveBet  (in)
/// @param  multiBankBet    (in) 
/// @param  balance         (out) user's balance after making this bet.
/// @param  comp            (out)
/// @param  payTable        (in)  which paytable setting the casino is using.
///
/// @return int32            TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CHoldemSQL::createGame(int32 casinoId, const PID& pid, bool8 forMoney, SESSIONID sessionId, 
                       int32 compFactor, CPokerGameID gid, int32 bet, int32 progressiveBet,
                       int32 multiBankBet, int32* balance, int32* comp, uint8 payTable)
{
    ODBCConnection* conn;
    ODBCQuery* query;
    bool8 ok = false;

    conn = m_pTracker->getConn();
    if (!conn)
    {
        return TrackSQL::NoConnection;
    }

    query = conn->query();

    if (query)
    {
        query->define("exec pub_CreateGameCHPoker ");
        query->addParam(casinoId);
        query->addParam(pid);
        query->addParam((bool8)(forMoney != 0));
        query->addParam(sessionId, ODBCQuery::NOQUOTES);
        query->addParam(compFactor);
        query->addParam(bet, ODBCQuery::MONEY);
        query->addParam(progressiveBet, ODBCQuery::MONEY);
        query->addParam(multiBankBet, ODBCQuery::MILLIMONEY);
        query->addParam(payTable);

        if (query->exec())
        {
            while (query->getRow())
            {
                ok =
                    query->getData(1, gid, CPOKER_GAMEID_SIZE) &&
                    query->getData(2, balance, ODBCQuery::MONEY) &&
                    query->getData(3, comp);
            }
        }
        delete query;
    }
    delete conn;

    if (ok)
    {
        #ifdef USE_MISSINGGAMENUMS
        int32 gamenum = atol(gid);
        if (missinggamenums)
                missinggamenums->setGameNum(gamenum);
        #endif
    }

    return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::deal(const PID& pid, CPokerGameID gid, int32 nDeckSeed)
///
/// Records information in the database about the cards just dealt and ties that info to the current game.
///
/// @param  pid             (in)  unique id of current player
/// @param  gid             (in)  unique id of current hand for this hand of Hold'em
/// @param  nDeckSeed       (in)  lets us reconstruct the hand if we need to for "saved game" purposes.  
/// @param  numPlayer       (in)  number of player cards
/// @param  player          (in)  player cards
/// @param  numCommunity    (in)  number of community cards
/// @param  community       (in)  community cards.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CHoldemSQL::deal(const PID& pid, CPokerGameID gid, int32 nDeckSeed, 
                 int32 numPlayer, uint8* player, int32 numCommunity, uint8* community)
{
    ODBCConnection* conn;
    ODBCQuery* query;
    bool8 ok = false;

    conn = m_pTracker->getConn();

    if (!conn)
    {
        return TrackSQL::NoConnection;
    }

    query = conn->query();

    if (query)
    {
        query->define("exec pub_CHPokerDeal ");
        query->addParam(pid);
        query->addParam(gid, ODBCQuery::NOQUOTES);
        query->addParam(nDeckSeed);                 // kharmon.  10-12-06.  #8226.  Only save the deck seed at this point in the game, not the dealer cards.
        query->addParam(player, numPlayer, ODBCQuery::BINARY);
        query->addParam(community, numCommunity, ODBCQuery::BINARY);

        if (query->exec())
        {
            ok = true;

            while (query->getRow()); /* ignore */ 
        }

        delete query;
    }

    delete conn;

    return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}






///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::gameDone(int32 casinoId, const PID& pid, bool8 forMoney, CPokerGameID gid, 
///                              bool8 raised, int32 payAnte, int32 payRaise, int32 payProgressive, 
///                              int32 payMultiBank, int32 outcome, int32 balanceAdjust, 
///                              int32* balance, int32* comp, bool8 bMalfunction, int32 numDealer, uint8* dealer,
///                              int32 numPlayer, uint8* player, int32 numCommunity, uint8* community)
///
/// Records information in the database about the outcome of the game that the user just played.
///
/// @param  casinoID        (in)
/// @param  pid             (in)  unique identifier for the current player
/// @param  forMoney        (in)  is this session for fun or for money?
/// @param  gid             (in)  unique identifier for this current hand of Hold'em
/// @param  raised          (in)  Did the user raise or fold?
/// @param  payAnte         (in)  How much did the user win OR lose off of the ante
/// @param  payRaise        (in)  How much did the user win OR lose off of the call.
/// @param  payMultiBank    (in)  How much (if anything) did the user win on the progressive?
/// @param  outcome         (in)  who won?
/// @param  balanceAdjust   (in)  Total amount won or lost by the user.
/// @param  balance         (out) user's balance after this game.
/// @param  comp            (out)
/// @param  bMalfunction    (in)  True if the user won a big progressive jackpot on this game.
/// @param  numDealer       (in)  number of dealer cards
/// @param  dealer          (in)  dealer cards
/// @param  numPlayer       (in)  number of player cards
/// @param  player          (in)  player cards
/// @param  numCommunity    (in)  number of community cards
/// @param  community       (in)  community cards.
///
/// @return int32            TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CHoldemSQL::gameDone(int32 casinoId, const PID& pid, bool8 forMoney, CPokerGameID gid, 
                     bool8 raised, int32 payAnte, int32 payRaise, int32 payProgressive, 
                     int32 payMultiBank, int32 outcome, int32 balanceAdjust, 
                     int32* balance, int32* comp, bool8 bMalfunction, int32 numDealer, uint8* dealer,
                     int32 numPlayer, uint8* player, int32 numCommunity, uint8* community)
{
    ODBCConnection* conn;
    ODBCQuery* query;
    bool8 ok = false;

    conn = m_pTracker->getConn();

    if (!conn)
    {
        return TrackSQL::NoConnection;
    }

    query = conn->query();

    if (query)
    {
        query->define("exec pub_CHPokerGameDone ");
        query->addParam(casinoId);
        query->addParam(pid);
        query->addParam((bool8)(forMoney != 0));
        query->addParam(gid, ODBCQuery::NOQUOTES);
        query->addParam((raised ? "R" : "F"));
        query->addParam(payAnte, ODBCQuery::MONEY);
        query->addParam(payRaise, ODBCQuery::MONEY);
        query->addParam(payProgressive, ODBCQuery::MONEY);
        query->addParam(payMultiBank, ODBCQuery::MILLIMONEY);

        query->addParam((uint8)(outcome & 0xffL), ODBCQuery::BINARY);
        query->addParam(balanceAdjust, ODBCQuery::MONEY);

        query->addParam(bMalfunction);  // kharmon.  01-05-06.  #4250.  The player won a big progressive jackpot...if true, stop them from playing until we've cleared this.

        query->addParam(dealer, numDealer, ODBCQuery::BINARY);      // kharmon.  10-12-06.  #8226.  Now that the game is done, it's safe to save the actual cards.
        query->addParam(player, numPlayer, ODBCQuery::BINARY);
        query->addParam(community, numCommunity, ODBCQuery::BINARY);

        if (query->exec())
        {
            while (query->getRow())
            {
                ok = query->getData(1, balance, ODBCQuery::MONEY) &&
                     query->getData(2, comp);
            }
        }

        delete query;
    }

    delete conn;

    return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn CHoldemSQL::hasSavedGame(const PID& pid, bool8 forMoney, CPokerGameID gid,  
///                              CSavedGame* dest, bool8* exists)
/// 
/// Checks for unfinished Caribbean Hold'em games that this player might have laying around and if one is
/// found, returns the state information to the caller so that the game can be reincarnated.
///
/// @param  pid             (in)  unique identifier for the current player
/// @param  forMoney        (in)  is this session for fun or for money?
/// @param  gid             (in)  unique identifier for this current Hold'em game
/// @param  dest            (out) if a saved game is found, it's state info is returned in here.
/// @param  exists          (out) true if we found a saved game, false if not.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CHoldemSQL::hasSavedGame(const PID& pid, bool8 forMoney, CPokerGameID gid, CSavedGame* dest, bool8* exists)
{
    ODBCConnection* conn;
    ODBCQuery* query;
    bool8 ok = false;

    *exists = false;

    conn = m_pTracker->getConn();
    if (!conn)
    {
        return TrackSQL::NoConnection;
    }

    query = conn->query();

    if (query)
    {
        query->define("exec pub_CHPokerGetSavedGame ");
        query->addParam(pid);
        query->addParam((bool8)(forMoney != 0));

        if (query->exec())
        {
            int32 hasSaved = 0;

            ok = true;

            while (query->getRow())
            {
                if (query->getData(1, &hasSaved) && hasSaved!=0)
                {
                    if(hasSaved==1)
                    {
                        *exists = true;

                        // kharmon.  10-12-06.  #8226.  This is an old game that doesn't have a deck seed.  Use the saved cards.
                        dest->bHasDeckSeed = false;
                        dest->nDeckSeed = 0;

                        query->getData(2, gid, CPOKER_GAMEID_SIZE);
                        query->getData(3, &dest->bet, ODBCQuery::MONEY);
                        query->getData(4, &dest->progressiveBet, ODBCQuery::MONEY);

                        query->getData(5, dest->dealerCards, CSavedGame::MAXCARDS, 
                                       &dest->numDealerCards);

                        query->getData(6, dest->playerCards, CSavedGame::MAXCARDS, 
                                       &dest->numPlayerCards);

                        query->getData(7, dest->communityCards, CSavedGame::MAXCARDS, 
                                       &dest->numCommunityCards);

                        query->getData(8, &dest->payTable);

                        // kharmon.  01-05-06.  #4250.  Did this game have a big progressive win?
                        query->getData(9, &dest->bMalfunction);
                    }
                    else if(hasSaved==2)
                    {
                        // kharmon.  10-12-06.  #8226.  A newer game that has a deck seed.
                        *exists = true;
                        dest->bHasDeckSeed = true;                        

                        query->getData(2, gid, CPOKER_GAMEID_SIZE);
                        query->getData(3, &dest->bet, ODBCQuery::MONEY);
                        query->getData(4, &dest->progressiveBet, ODBCQuery::MONEY);
                        query->getData(5, &dest->nDeckSeed);    
                        query->getData(6, &dest->payTable);     
                        query->getData(7, &dest->bMalfunction); // kharmon.  01-05-06.  #4250.  Did this game have a big progressive win?
                    }
                }
            }
        }

        delete query;
    }

    delete conn;

    return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::saveGame(const PID& pid, bool8 forMoney, CPokerGameID gid, CSavedGame* src)
///
/// Could be used to store data for each game after the cards are dealt, for use by the restore operation.
/// BUT, in Hold'em's case, this happens in trackDeal, so nothing to do.  Just a place holder.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CHoldemSQL::saveGame(const PID& pid, bool8 forMoney, CPokerGameID gid, CSavedGame* src)
{
    return TrackSQL::NoError;
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::getOptions(bool8* progressiveOn, bool8* crossCasinoOn, uint8* progPayTable, 
///                                int32* progJackpotID, uint8* payTable, int32* progressiveFixAmountMultiplier))
///
/// Returns the specific setup options that the casino has selected for Caribbean Hold'em.
///
/// @param  progressiveOn       (out) enable progressive?
/// @param  crossCasinoOn       (out) enable cross casino stuff?
/// @param  progPayTable        (out) which set of payout numbers to use for progressive wins?
/// @param  progJackpotID       (out) 
/// @param  payTable            (out) which set of payout numbers should be used for normal wins?
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CHoldemSQL::getOptions(bool8* progressiveOn, uint8* progPayTable, 
                       int32* progJackpotID, uint8* payTable, int32* progressiveFixAmountMultiplier)
{
    ODBCConnection* conn;
    ODBCQuery* query;
    bool8 ok = false;
    uint8 bit1=0, bit2=0, tinyint=0;
    int32 int1=0, int2=0, int3=0;

    conn = m_pTracker->getConn();
    if (!conn)
    {
        return TrackSQL::NoConnection;
    }

    query = conn->query();
    if (query)
    {
        query->define("exec pub_CHPokerGetOptions ");

        if (query->exec())
        {
            while (query->getRow())
            {
                ok = query->getData(1, &bit1) &&
                     query->getData(2, &bit2) &&
                     query->getData(3, &tinyint)  &&
                     query->getData(4, &int1) &&
                     query->getData(5, &int2) && // [AO 2008-03-28]
                     query->getData(6, &int3);

                if (ok)
                {
                    *progressiveOn = (bool8)(bit1 != 0);
                    *progPayTable = (uint8)tinyint;
                    *progJackpotID = (int32)int1;
                    *payTable = (uint8)(int2 & 0xff);
                    *progressiveFixAmountMultiplier = int3;

                    if(*payTable<0 || *payTable>= CHoldemGame::MAX_CHOLDEM_PAY_FREQUENCIES)
                    {
                        *payTable = 0;
                    }

                    if(*progPayTable<0 || *progPayTable>= CHoldemGame::MAX_CHOLDEM_PROGRESSIVE_PAY_FREQUENCIES)
                    {
                        *progPayTable = 0;
                    }
                }
            }
        }

        delete query;
    }

    delete conn;

    return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::trackNewGame(int32 Bet, int32 ProgressiveBet, int32 multiBankBet, 
///                                  int32 *Balance, uint8 payTable, int32 compFactor)
///
/// Creates database records for a new Caribbean Holdem game.
///
/// @param  Bet             (in)  
/// @param  ProgressiveBet  (in)
/// @param  multiBankBet    (in) 
/// @param  Balance         (out) user's balance after making this bet.
/// @param  payTable        (in)  which paytable setting the casino is using.
/// @param  compFactor      (in)
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CHoldemSQL::trackNewGame(int32 Bet, int32 ProgressiveBet, int32 multiBankBet, 
                       int32 *Balance, uint8 payTable, int32 compFactor)
{
    int32 result = TrackSQL::ExecFailed;
    int32 comp;

    if (m_pTracker && m_pInfo)
    {
        m_pTracker->lock();

        result = createGame(ServerOpts::casinoId, m_pInfo->pid, m_pInfo->forMoney, 
                            m_pInfo->sessionId, m_pInfo->forMoney ? compFactor : 0,
                            m_pInfo->gid, Bet, ProgressiveBet, multiBankBet, Balance, 
                            &comp, payTable);

        m_pTracker->unlock();
    }

    return (bool8)(result == TrackSQL::NoError);
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::trackDeal(CGame *pGame)
///
/// Records information in the database about the cards just dealt and ties that info to the current game.
///
/// @param  pGame       (in)  the game object that we're saving information about.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CHoldemSQL::trackDeal(CGame *pGame)
{
    int32 result = TrackSQL::ExecFailed;

    if (m_pTracker && m_pInfo)
    {
        CHoldemGame *pHoldem =  (CHoldemGame *) pGame;

        CHoldemHand *pPlayer = pHoldem->getPlayerHand();

        Hand *pCommunity     = pHoldem->getCommunityCards();

        m_pTracker->lock();

        result = deal(m_pInfo->pid, m_pInfo->gid, pHoldem->getDeckSeed(),
                      pPlayer->getCount(), pPlayer->getCards(),
                      3, pCommunity->getCards());   // kharmon.  11-07-06.  #8226.  Only save the first 3 community cards.

        m_pTracker->unlock();
    }
    return (bool8)(result == TrackSQL::NoError);
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::trackGameDone(bool8 Raised, int32 PayAnte, int32 PayRaise, int32 PayProgressive,
///                                   int32 PayMultiBank, int32 Outcome, int32 BalAdjust, int32 *Balance)
///
/// Records information in the database about the outcome of the game that the user just played.
///
/// @param  Raised          (in)  Did the user raise or fold?
/// @param  PayAnte         (in)  How much did the user win OR lose off of the ante
/// @param  PayRaise        (in)  How much did the user win OR lose off of the call.
/// @param  PayProgressive  (in)  How much (if anything) did the user win on the progressive?
/// @param  PayMultiBank    (in)
/// @param  Outcome         (in)  who won?
/// @param  BalAdjust       (in)  Total amount won or lost by the user.
/// @param  Balance         (out) user's balance after this game.
/// @param  bMalfunction    (in)  True if the user won a big progressive jackpot on this game.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CHoldemSQL::trackGameDone(bool8 Raised, int32 PayAnte, int32 PayRaise, int32 PayProgressive,
                          int32 PayMultiBank, int32 Outcome, int32 BalAdjust, int32 *Balance,
                          bool8 bMalfunction, CGame *pGame)
{
    int32 result = TrackSQL::ExecFailed;
    int32 comp;

    if (m_pTracker && m_pInfo)
    {
        m_pTracker->lock();

        CHoldemGame *pHoldem =  (CHoldemGame *) pGame;

        result = gameDone(ServerOpts::casinoId, m_pInfo->pid, m_pInfo->forMoney, m_pInfo->gid,
                          Raised, PayAnte, PayRaise, PayProgressive, PayMultiBank, Outcome, 
                          BalAdjust, Balance, &comp, bMalfunction, 
                          pHoldem->getDealerHand()->getCount(), pHoldem->getDealerHand()->getCards(), 
                          pHoldem->getPlayerHand()->getCount(), pHoldem->getPlayerHand()->getCards(),
                          pHoldem->getCommunityCards()->getCount(), pHoldem->getCommunityCards()->getCards());

        m_pTracker->unlock();
    }

    return (bool8)(result == TrackSQL::NoError);
}





///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::trackHasSavedGame(CPokerConnection *pConn, CGame ** ppGame, int32 * err)
///
/// Checks for unfinished Caribbean Hold'em games that this player might have laying around and if one is
/// found, returns the state information to the caller so that the game can be reincarnated.
///
/// @param  pConn       this method may create a new Holdem game, and this is needed if it does
/// @param  ppGame      pointer to new Holdem game, IF one is created.
/// @param  err         if something goes wrong, the value returned should give some idea of what
///
/// @return bool8       true if a game was re-created successfully.  false otherwise.
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CHoldemSQL::trackHasSavedGame(CPokerConnection *pConn, CGame ** ppGame, int32 * err)
{
    CSavedGame sg;
    bool8 exists;
    int32 result = TrackSQL::ExecFailed;

    if (m_pTracker && m_pInfo)
    {
        m_pTracker->lock();

        result = hasSavedGame(m_pInfo->pid, m_pInfo->forMoney,
                              m_pInfo->gid, &sg, &exists);

        if (result == TrackSQL::NoError)
        {
            if (exists)
            {
                *ppGame = new CHoldemGame(pConn, &sg);
            }
            else
            {
                memset(m_pInfo->gid, 0xff, sizeof(CPokerGameID));
            }
        }

        m_pTracker->unlock();
    }

    if (*ppGame && !(*ppGame)->isGameOK())
        *err = LOGINERR_CONTACTCUSTSERVICE;
    else if (result != TrackSQL::NoError)
        *err = LOGINERR_TRYLATER;
    else
        *err = 0;

    return (bool8)((result == TrackSQL::NoError) && *ppGame && (*ppGame)->isGameOK());
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::trackSaveGame(CGame *pGame)
///
/// Doesn't actually do anything.  Just a place holder.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CHoldemSQL::trackSaveGame(CGame *pGame)
{
    CSavedGame sg;
    int32 result = TrackSQL::ExecFailed;

    if (!pGame)
    {
        return true;
    }

    if (m_pTracker && m_pInfo)
    {
        pGame->save(&sg);

        m_pTracker->lock();
        result = saveGame(m_pInfo->pid, m_pInfo->forMoney, m_pInfo->gid, &sg);
        m_pTracker->unlock();

        return (bool8)(result == TrackSQL::NoError);
    }

    return false;
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CHoldemSQL::trackGetOptions(bool8* progressiveOn, bool8* crossCasinoOn, uint8* progPayTable, 
///                            int32* progJackpotID, uint8* payTable)
///
/// Returns the specific setup options that the casino has selected for Caribbean Hold'em.
///
/// @param  progressiveOn       (out) enable progressive?
/// @param  crossCasinoOn       (out) enable cross casino stuff?
/// @param  progPayTable        (out) which set of payout numbers to use for progressive wins?
/// @param  progJackpotID       (out) 
/// @param  payTable            (out) which set of payout numbers should be used for normal wins?
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CHoldemSQL::trackGetOptions(bool8* progressiveOn, uint8* progPayTable, 
                            int32* progJackpotID, uint8* payTable, int32* progressiveFixAmountMultiplier)
{
    int32 result = TrackSQL::ExecFailed;

    if (m_pTracker)
    {
        m_pTracker->lock();
        result = getOptions(progressiveOn, progPayTable, progJackpotID, payTable, progressiveFixAmountMultiplier);
        m_pTracker->unlock();
    }

    if (result == TrackSQL::NoError)
    {
        return true;
    }

    return false;
}

